package com.example.demorabbitmq.listener;

import com.example.demorabbitmq.constant.Constants;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

@Component
public class TopicListener {
    @RabbitListener(queues = Constants.TOPICS_QUEUE1)
    public void listenerQueue(String message) {
        System.out.println("listener 1[ " + Constants.TOPICS_QUEUE1 + " ] 收到消息：" + message);
    }

    @RabbitListener(queues = Constants.TOPICS_QUEUE2)
    public void listenerQueue2(String message) {
        System.out.println("listener 2[ " + Constants.TOPICS_QUEUE2 + " ] 收到消息：" + message);
        System.out.println("listener 2[ " + Constants.TOPICS_QUEUE2 + " ] 收到消息：" + message);
    }

}
